package org.pzy.netty.eventloop;

import io.netty.channel.Channel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.ScheduledFuture;

import java.util.concurrent.TimeUnit;

/**
 * @Author: DRevelation
 * @Date: 2021/12/1 9:30
 */
public class EventLoopDemo {
    public static void main(String[] args) {
        Channel channel = new NioSocketChannel();
        ScheduledFuture<?> future = channel.eventLoop().scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                System.out.println("Run every 60 seconds");
            }
        }, 60, 60, TimeUnit.SECONDS);

        future.cancel(false);
    }
}
